import * as CONSTANT from '../constant'

const defaultState = {
    tags: [],
    tag: null
}

const tagReducer = (state = defaultState, action) => {
    let tags;
    let tag;
    switch (action.type) {
        case CONSTANT.TAG_GET_RESULT:
            tags = action.payload
            return {...state, tags}
        case CONSTANT.TAG_SYNC:
            tag = action.payload
            return {...state, tag}
        default:
            return state
    }
}

export default tagReducer;